<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
	<%@ include file="/WEB-INF/pages/weixin/include/title.jsp"%>
</head>
<body>
    <!-- 内容部分Start -->
    <div class="contentPanel wxbg">
	    	<div class="weui-panel__hd" id="returnBtn" position="top"> &lt 返回列表</div>
		    <div position="center">
			    <div class="page__bd">
			        <div class="weui-form-preview">
			            <div class="weui-form-preview__hd">
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label" >服务名称</label>
			                    <em class="weui-form-preview__value" id="serviceName"></em>
			                </div>
			            </div>
			            <div class="weui-form-preview__bd">
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">申请企业</label>
			                    <span class="weui-form-preview__label" id="reqEnt"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">申请企业联系人</label>
			                    <span class="weui-form-preview__label" id="reqPerson"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">申请企业联系电话</label>
			                    <span class="weui-form-preview__label" id="reqPhone"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">申请描述</label>
			                    <span class="weui-form-preview__label" id="reqDesc"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">申请时间</label>
			                    <span class="weui-form-preview__label" id="reqTime"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">服务状态</label>
			                    <span class="weui-form-preview__label" id="serviceStatus"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">服务开始时间</label>
			                    <span class="weui-form-preview__label" id="serviceStart"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">服务结束时间</label>
			                    <span class="weui-form-preview__label" id="serviceEnd"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">服务成果</label>
			                    <span class="weui-form-preview__label" id="serviceResult"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">服务收入</label>
			                    <span class="weui-form-preview__label" id="serviceMoney"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">服务提供中介</label>
			                    <span class="weui-form-preview__label" id="serviceOrg"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">评价中介综合评分</label>
			                    <span class="weui-form-preview__label" id="serviceOrgComt"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">评价中介服务态度</label>
			                    <span class="weui-form-preview__label" id="serviceOrgTComt"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">评价中介专业水平</label>
			                    <span class="weui-form-preview__label" id="serviceOrgZComt"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">服务描述是否相符</label>
			                    <span class="weui-form-preview__label" id="serviceDesc"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">评价中介说明</label>
			                    <span class="weui-form-preview__label" id="comtOrgDesc"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">评价企业综合评分</label>
			                    <span class="weui-form-preview__label" id="comtOrg"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">企业付款是否及时</label>
			                    <span class="weui-form-preview__label" id="payDesc"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">评价企业说明</label>
			                    <span class="weui-form-preview__label" id="comtEntDesc"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">反馈</label>
			                    <span class="weui-form-preview__label" id="feedback"></span>
			                </div>
			                <div class="weui-form-preview__item">
			                    <label class="weui-form-preview__label">申请服务</label>
			                </div>
			           </div>
			           <div class="weui-form-preview__ft">
		                	<a class="weui-form-preview__btn weui-form-preview__btn_primary acceptPanel hide" href="javascript:">受理操作</a>
		                	<a class="weui-form-preview__btn weui-form-preview__btn_primary dealPanelBtn hide" href="javascript:">处理操作</a>
		                	<a class="weui-form-preview__btn weui-form-preview__btn_primary feedPanelBtn hide" href="javascript:">反馈操作</a>
		            	</div>
			       </div>
			       
		            <!-- 不受理原因 -->
		            <div class="weui-cells weui-cells_form acceptPanel hide" style="margin-left: -15px;margin-right:  -15px;">
					    <div class="weui-cell">
					        <div class="weui-cell__bd">
					            <textarea class="weui-textarea" placeholder="若不受理，此项必填" rows="3" id="service_content"></textarea>
					        </div>
					    </div>
					</div>
					<!-- 处理结果 -->
					<div class="weui-cells weui-cells_form dealPanel hide" style="margin-left: -15px;margin-right:  -15px;">
					    <div class="weui-cell">
					        <div class="weui-cell__bd">
					            <textarea class="weui-textarea" placeholder="服务收入（单位：万元）" rows="1" id="serviceIncome"></textarea>
					        </div>
					    </div>
					</div>
					<div class="weui-cells weui-cells_form dealPanel hide" style="margin-left: -15px;margin-right:  -15px;">
					    <div class="weui-cell">
					        <div class="weui-cell__bd">
					            <textarea class="weui-textarea" placeholder="服务成果（250字以内）" rows="3" id="serviceGain"></textarea>
					        </div>
					    </div>
					</div>
					<!-- 反馈信息 -->
					<div class="weui-cells weui-cells_form feedPanel hide" style="margin-left: -15px;margin-right:  -15px;">
					    <div class="weui-cell">
					        <div class="weui-cell__bd">
					            <textarea class="weui-textarea" placeholder="反馈意见（250字以内）" rows="3" id="feedContent"></textarea>
					        </div>
					    </div>
					</div>
					
				</div>
				<div class="weui-btn-area" style="margin-bottom: 20px;">
				    <a class="weui-btn weui-btn_primary acceptPanel hide" href="javascript:" id="acceptBtn">受理</a>
				    <a class="weui-btn weui-btn_warn acceptPanel hide" href="javascript:" id="noAcceptBtn">不受理</a>
				    <a class="weui-btn weui-btn_primary dealPanel hide" href="javascript:" id="dealBtn">处理</a>
				    <a class="weui-btn weui-btn_primary feedPanel hide" href="javascript:" id="feedbackBtn">反馈</a>
				</div>
		   </div>
		</div>
		<!-- 内容部分End -->
		
		<!-- 操作提示部分Start -->
		<div class="page msgPanel hide">
		    <div class="weui-msg">
		        <div class="weui-msg__icon-area"><i class="weui-icon-success weui-icon_msg"></i></div>
		        <div class="weui-msg__text-area">
		            <h2 class="weui-msg__title">操作成功</h2>
		        </div>
		        <div class="weui-msg__opr-area">
		            <p class="weui-btn-area">
		                <a href="javascript:history.go(0);" class="weui-btn weui-btn_primary">返回操作</a>
		            </p>
		        </div>
		        <div class="weui-msg__extra-area">
		            <div class="weui-footer">
		                <p class="weui-footer__links">
		                    <a href="javascript:void(0);" class="weui-footer__link"></a>
		                </p>
		                <p class="weui-footer__text"></p>
		            </div>
		        </div>
		    </div>
		</div>
		<!-- 操作提示部分End -->
		
	    <script type="text/javascript">
	    $(function () {
	    	var queryState = '${param.queryState}';
	    	var serviceId = '${param.id}';
	    	$(".hide").hide();
	    	wxUtils.loadData({
	    		urlFun:function(){
	    			return JSON.stringify({"id":serviceId,"method":"tmp_x102"});
	    		},
	    		showFun:function(data){
	    			 var bean = data.datalist[0];
	                 $("#serviceName").append(bean["SERVICE_NAME"]);
	                 $("#reqEnt").append(bean["ACCEPT_ENT_NAME"]);
	                 $("#reqPerson").append(wxUtils.defaultIfEmpty(bean["ACCEPT_ENT_LINKMAN"]));
	                 $("#reqPhone").append(wxUtils.defaultIfEmpty(bean["ACCEPT_ENT_LINKPHONE"]));
	                 $("#reqDesc").append(wxUtils.titleFormat(wxUtils.defaultIfEmpty(bean["APPLY_DESCRIBE"])));
	                 $("#reqTime").append(bean['APPLY_TIME'].substring(0,10));
	                 $("#serviceStatus").append(wxUtils.getServiceStatus(bean["SERVICE_STATUS"]));
	                 $("#serviceStart").append(wxUtils.defaultIfEmpty(bean["START_TIME"]));
	                 $("#serviceEnd").append(wxUtils.defaultIfEmpty(bean["END_TIME"]));
	                 $("#serviceResult").append(wxUtils.titleFormat(wxUtils.defaultIfEmpty(bean["SERVICE_GAIN"])));
	                 $("#serviceMoney").append(wxUtils.defaultIfEmpty(bean["SERVICE_INCOME"]));
	                 $("#serviceOrg").append(wxUtils.defaultIfEmpty(bean["PROVIDE_ENT_NAME"]));
	                 $("#serviceOrgComt").append(wxUtils.defaultIfEmpty(bean["EVALUATE_SUM_ORG"]));
	                 $("#serviceOrgTComt").append(wxUtils.defaultIfEmpty(bean["EVALUATE_ATTITUDE_ORG"]));
	                 $("#serviceOrgZComt").append(wxUtils.defaultIfEmpty(bean["PROFESSIONAL_STANDARDS_ORG"]));
	                 $("#serviceDesc").append(wxUtils.titleFormat(wxUtils.defaultIfEmpty(bean["IS_MATCHED"])));
	                 $("#comtOrgDesc").append(wxUtils.titleFormat(wxUtils.defaultIfEmpty(bean["SERVICE_SUGGESTION_ORG"])));
	                 $("#comtOrg").append(wxUtils.defaultIfEmpty(bean["SERVICE_SUGGESTION_ENT"]));
	                 $("#payDesc").append(wxUtils.defaultIfEmpty(bean["PAY_IN_TIME"]));
	                 $("#comtEntDesc").append(wxUtils.defaultIfEmpty(bean["NOT_DEAL_REASON"]));
	                 $("#feedback").append(wxUtils.titleFormat(wxUtils.defaultIfEmpty(bean["FEEDBACK_CONTENT"])));
	    		}
	    	});
	    	
	    	$("#returnBtn").click(function(){
	    		wxUtils.returnList();
	    	});
	    	
	    	//控制操作显示
	    	var showInputs=function(state){
	             if(state=='tmp_f102'){
	               $(".acceptPanel").show();
	             }
	             if(state=='tmp_f103'){
	            	 $(".dealPanel").show();
	            	 $(".dealPanelBtn").show().click(function(){
	            		 $(".feedPanel").hide();
	            		 $(".dealPanel").show();
	            		 $(this).removeClass('weui-form-preview__btn_default').addClass('weui-form-preview__btn_primary');
	            		 $(".feedPanelBtn").removeClass('weui-form-preview__btn_primary').addClass('weui-form-preview__btn_default');
	            	 });
	            	 $(".feedPanel").show();
	            	 $(".feedPanelBtn").show().click(function(){
	            		 $(".dealPanel").hide();
	            		 $(".feedPanel").show();
	            		 $(this).removeClass('weui-form-preview__btn_default').addClass('weui-form-preview__btn_primary');
	            		 $(".dealPanelBtn").removeClass('weui-form-preview__btn_primary').addClass('weui-form-preview__btn_default');
	            	 });
	            	 $(".dealPanelBtn").click();
	             }
	             if(state=='tmp_f104'){
	            	 $(".dealPanelBtn").show();
	            	 $(".feedPanel").show();
	             }
	             if(state=='feed'){
	            	 $(".dealPanelBtn").show();
	               	$(".feedPanel").show();
	             }
	        }
	    	showInputs(queryState);
	    	
	    	//受理&不受理操作
	    	var serviceAccept = function(userId,state){
	    		var serviceContent = $("#service_content").val();
	            if(state=='1' && $.trim(serviceContent)==''){
	            	wxUtils.confirm('请输入不受理理由',function(){
	            		alert(1111);
	            	});
	            	return false;
	            	wxUtils.alert("请输入不受理理由",function(){
	                	$("#service_content").focus();
	            	});
	            }else{
	                var method = "handle";
	                var methodLabel = "受理";
	                if(state=='1'){
	                    method = "nohandle";
	                    methodLabel = "不受理";
	                }
	                wxUtils.confirm("确认是否"+methodLabel+"？",function(){
	                	wxUtils.loadData({
		        	    		urlFun:function(){
		        	    			return JSON.stringify({"method":method,"ompServiceProcessId":serviceId,"userId":userId,"notDealReason":serviceContent});
		        	    		},
		        	    		showFun:function(data){
		        	    			if(data["state"]=="suceess"){
		        	    				suceessMsg();
                                    }else{
                                    	wxUtils.alert("操作失败，请稍后重试");
                                    }
		        	    		}
		        	    });
	                });
	            }
	        }
	    	$("#acceptBtn").click(function(){
	    		wxUtils.getUserInfo(function(data){
	    			serviceAccept(data.userid,'0')
	    		});
	    	});
	    	$("#noAcceptBtn").click(function(){
	    		wxUtils.getUserInfo(function(data){
	    			serviceAccept(data.userid,'1')
	    		});
	    	});
	        
	    	//处理操作
	        var serviceDeal=function(userId){
	            var serviceIncome = $.trim($("#serviceIncome").val());
	            var serviceGain = $.trim($("#serviceGain").val());
	            if(serviceIncome==''){
	                wxUtils.alert("服务收入不可为空",function(){
	                	$("#serviceIncome").focus();
	                });
	                return false;
	            }
	            if(!wxUtils.isNumber(serviceIncome)){
	            	wxUtils.alert("服务收入非有效数值",function(){
	            		$("#serviceIncome").focus();
	            	});
	                return false;
	            }
	            if(serviceGain==''){
	            	wxUtils.alert("服务成果不可为空",function(){
	            		$("#serviceGain").focus();
	            	});
	                return false;
	            }
	            wxUtils.confirm("确认是否执行处理完毕操作？",function(){
	            	wxUtils.loadData({
	        	    		urlFun:function(){
	        	    			return JSON.stringify({"method":"handleOver","ompServiceProcessId":serviceId,"userId":userId,"serviceIncome":serviceIncome,"serviceGain":serviceGain});
	        	    		},
	        	    		showFun:function(data){
	        	    			if(data["state"]=="suceess"){
	        	    				suceessMsg();
	                            }else{
	                            	wxUtils.alert("操作失败，请稍后重试");
	                            }
	        	    		}
	        	     });
	            });
	        }
	        $("#dealBtn").click(function(){
	        	wxUtils.getUserInfo(function(data){
	        		serviceDeal(data.userid);
	        	});
	    	});
	        
	    	//反馈操作
	        var serviceFeed=function(userId){
	            var feedContent = $.trim($("#feedContent").val());
	            if(feedContent==''){
	                wxUtils.alert("反馈意见不可为空",function(){
	            		$("#feedContent").focus();
	                });
	                return false;
	            }
	            wxUtils.confirm("确认是否执行反馈操作？",function(){
	            	wxUtils.loadData({
	        	    		urlFun:function(){
	        	    			return JSON.stringify({"method":"saveFeedBack","ompServiceProcessId":serviceId,"userId":userId,"feedbackContent":feedContent});
	        	    		},
	        	    		showFun:function(data){
	        	    			if(data["state"]=="suceess"){
	        	    				suceessMsg();
	                            }else{
	                                wxUtils.alert("操作失败，请稍后重试");
	                            }
	        	    		}
	        	     });
	             });
	        }
	        $("#feedbackBtn").click(function(){
	        	wxUtils.getUserInfo(function(data){
	        		serviceFeed(data.userid)
	        	});
	    	});
	        
	        //操作成功提示
			var suceessMsg = function(msg){
	        	if(msg){
	        		$(".msgPanel").find(".weui-msg__title").html(msg);
	        	}else{
	        		$(".msgPanel").find(".weui-msg__title").html('操作成功');
	        	}
	        	$(".contentPanel").hide();
	        	$(".msgPanel").fadeIn(200);
	        }
			wxUtils.iniScrollBar();
	    });
	  </script>
	  
</body>
</html>